package utils;


import java.util.Random;

/**
 * Class to handle some 2D computations, taken from differents sources. 
 *  
 * @author L. Simon, Univ. Paris Sud, 2008
 *
 */
public class Vector2d
{
    public Vector2d()
    {
        setZero();
    }

    public Vector2d(float x, float y)
    {
        set(x, y);
    }

    public void set(Vector2d that)
    {
        x = that.x;
        y = that.y;
    }

    public void set(float x, float y)
    {
        this.x = x;
        this.y = y;
    }

    public void setZero()
    {
        set(0.0F, 0.0F);
    }

    public float distance(Vector2d that)
    {
    	return (float)Math.sqrt((x-that.x)*(x-that.x)+(y-that.y)*(y-that.y));
    }

    public float x;
    public float y;
    
    public String toString()
    {
    	return " x: " + x + " y: " + y;
    }
}
